package com.hashnode.controller;

import com.hashnode.domain.CommonResult;
import com.hashnode.service.AccountService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.math.BigDecimal;

@RestController
public class AccountController {
    @Resource
    AccountService accountService;

    /**
     * 扣减账户余额
     */
//    @PostMapping("/account/decrease")
    @RequestMapping("/account/decrease") //以任何请求形式都可以访问
    public CommonResult decrease(@RequestParam("userId") Long userId, @RequestParam("money") Long money){
        accountService.decrease(userId,money);
        return new CommonResult(200,"扣减账户余额成功！");
    }
}
